package com.jml.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

@Service("myEventService")
public class MyEventService {

    public MyEventService() {
        System.out.println("MyEventService init");
    }

    @Autowired
    private ApplicationContext applicationContext;

    public void testEvent(){
        Myevent myevent = new Myevent();
        myevent.memo = "第一个注解事件";
        applicationContext.publishEvent(myevent);
        //applicationContext.publishEvent(new MyApplicationContextEvent(applicationContext,"第二个事件"));

    }
}
